%label.control-label{ :for => "overview" }
  %a.btn.btn-info{ :href=> "#modaloverview", "data-toggle" => "modal" }
    UDOs Overview
.modal.modal.hide.fade#modaloverview{ :tabindex =>  "-1", :role => "dialog" }
  .modal-dialog.modal-lg{ :role => "document" }
    .modal-content
      .modal-header
        %h3#modal-label
          User Defined Objects
        %button.close{ :type => "button", "data-dismiss" => "modal", "aria-label" => "Close" }
          &times;
      .modal-body
        %p
          An User Defined Object can be anything that is usually tied to more than one information : contact (mail, name, role...), applications (URL, IP, Name...).
        %p
          User Defined Objects, once created, can be used in your templates with all meta characters. For this, the following path should be used:
        %p /root/udo/&lt&ltobject name&gt&gt/&lt&ltproperty name&gt&gt.
        %p
          For exemple, if you have an object <b>Application</b> with the properties <b>IP</b> and <b>URL</b>, you could do the following:
          %div{:style => "background-color:#F2F3F4"}
            %p
              ¬report/udo/application¬
            %p
              IP : πIPπ
            %p
              URL : πURLπ
            %p
              ∆
          %p
            %br
            This would print in your report all the IP and URL of the created applications.
          %p
            %strong
              If you put a space in your properties, they will be replaced by an underscore in the corresponding path
          %p
            %strong
              Meta markup is support by UDOs
%br
%br
- if @udo_template_created
  %h2.h5 New #{@udo_template_created.type} object created !
  %br
- if not @udos_templates.empty?
  - @udos_templates.each do |udo_template|
    - i = 1
    %hr
    %h3.h4
      #{udo_template.type}
      %a.btn.btn-sm.btn-info{ :href => "/report/#{@id}/udo/#{udo_template.id}/create" }
        %i.fas.fa-plus{ :title => "Create new #{udo_template.type}" }
    - udos_linked_to_current_template = UserDefinedObjects.all(:template_id => udo_template.id, :report_id => @id)
    - if not udos_linked_to_current_template.empty?
      .table.table-striped
        %table{ :style => "white-space: nowrap; table-layout: fixed" }
          %thead
            %tr
              %td
                %strong
                  N°
              - template_properties = JSON.parse(udo_template.udo_properties)
              - template_properties.each do |property_name, property_default_value|
                %td
                  %strong
                    %i
                      #{property_name}
              %td
                %strong
                  Actions
          %tbody
            - udos_linked_to_current_template.each do |udo|
              %tr
                %td
                  #{i}
                - i += 1
                - properties = JSON.parse(udo.udo_properties)
                - template_properties.each do |template_property_name, template_property_value|
                  %td{ :style => "overflow:hidden;text-overflow:ellipsis;max-width: 300px;" }
                    #{meta_markup(properties[template_property_name.downcase])}
                %td
                  %a.btn.btn-warning.btn-sm{ :href => "/report/#{@id}/udo/#{udo.id}/edit" }
                    %i.fas.fa-pencil-alt{ :title => "Edit this #{udo_template.type.downcase}" }
                  %a.btn.btn-danger.btn-sm{ :href => "/report/#{@id}/udo/#{udo.id}/delete" }
                    %i.far.fa-trash-alt{ :title => "Delete this #{udo_template.type.downcase}" }
    - else
      You have no #{udo_template.type.downcase} yet !
      %br
      %br
    %br
- else
  %h1.h4 No UDO Template. Ask your administrator to create the UDO templates you want to use in your report.
